package cn.crex1.xiaomi.dao;

import cn.crex1.xiaomi.core.orm.annotion.Query;
import cn.crex1.xiaomi.core.orm.annotion.ResultType;
import cn.crex1.xiaomi.vo.UserVO;

public interface UserDao {
//	登录查询
	@Query(sql="select user_id from os_user where telephone=? and login_password=?" )

//	@Query(sql="update user set username=?,password=? where userId =?" )
//	@Query(sql="delete from user where userId=?" )
//    @Query(sql="select * from user" )
	@ResultType(value="int")
    int selectOsUserByTelephoneAndPassword(UserVO uservo);
	
//	注册操作
	@Query(sql="insert into os_user(user_name,login_password,telephone,regeist_time) values(?,?,?,?)" )
	@ResultType(value="int")
	int updateOsUserByTelephoneAndPassword(UserVO uservo);
//	查询用户名是否已经注册
	@Query(sql="select user_id from os_user where user_name=?")
	@ResultType(value="int")
	int selectOsUserByUserName(UserVO uservo);
//	查询手机号是否已注册
	@Query(sql="select user_id from os_user where telephone=?")
	@ResultType(value="int")
	int selectOsUserByTelephone(UserVO uservo);
	
	@Query(sql="select user_name from os_user where user_id=?")
	@ResultType("string")
	String selectUsernameByUserId(Integer userId);
	
	//查询手机号码
	@Query(sql="select telephone from os_user where user_id=?")
	@ResultType("int")
	Long selectTelephoneByUserId(Integer userId);	
}
